#pragma once

namespace vex { namespace functional {
    template<class TSignature, class TNewRet> 
    struct replace_result;

    template<class TOldRet, class TNewRet> 
    struct replace_result<TOldRet (), TNewRet> {
        typedef TNewRet (type)();
    };

    template<class TOldRet, class TArg1, class TNewRet> 
    struct replace_result<TOldRet (TArg1), TNewRet> {
        typedef TNewRet (type)(TArg1);
    };

    template<class TOldRet, class TArg1, class TArg2, class TNewRet> 
    struct replace_result<TOldRet (TArg1, TArg2), TNewRet> {
        typedef TNewRet (type)(TArg1, TArg2);
    };

    template<class TOldRet, class TArg1, class TArg2, class TArg3, class TNewRet> 
    struct replace_result<TOldRet (TArg1, TArg2, TArg3), TNewRet> {
        typedef TNewRet (type)(TArg1, TArg2, TArg3);
    };

    template<class TOldRet, class TArg1, class TArg2, class TArg3, class TArg4, class TNewRet> 
    struct replace_result<TOldRet (TArg1, TArg2, TArg3, TArg4), TNewRet> {
        typedef TNewRet (type)(TArg1, TArg2, TArg3, TArg4);
    };

    template<class TOldRet, class TArg1, class TArg2, class TArg3, class TArg4, class TArg5, class TNewRet> 
    struct replace_result<TOldRet (TArg1, TArg2, TArg3, TArg4, TArg5), TNewRet> {
        typedef TNewRet (type)(TArg1, TArg2, TArg3, TArg4, TArg5);
    };
}}